WPS Office.apk(点击下载) / h.java


package com.kingsoft.iciba.sdk2;

import android.content.Context;
import android.util.Log;
import com.baidu.tts.loopj.AsyncHttpClient;
import com.baidu.tts.loopj.AsyncHttpResponseHandler;
import com.mopub.mobileads.VastExtensionXmlManager;
import java.io.File;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;

/* access modifiers changed from: package-private */
public final class h implements Runnable {
    private /* synthetic */ File F;
    private /* synthetic */ Context G;
    private /* synthetic */ long H;

    h(File file, Context context, long j) {
        this.F = file;
        this.G = context;
        this.H = j;
    }

    public final void run() {
        try {
            if (this.F.exists() && this.F.length() > 0) {
                HashMap hashMap = (HashMap) new ObjectInputStream(new FileInputStream(this.F)).readObject();
                if (hashMap.size() > 0) {
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put(VastExtensionXmlManager.TYPE, 2);
                    if (hashMap.containsKey("click_event")) {
                        JSONObject jSONObject2 = new JSONObject();
                        HashMap hashMap2 = (HashMap) hashMap.get("click_event");
                        for (String str : hashMap2.keySet()) {
                            jSONObject2.put(str, new JSONObject((String) hashMap2.get(str)).getInt("click_number"));
                        }
                        jSONObject.put("click_event", jSONObject2);
                    }
                    if (hashMap.containsKey("search_history")) {
                        JSONArray jSONArray = new JSONArray();
                        HashMap hashMap3 = (HashMap) hashMap.get("search_history");
                        for (String str2 : hashMap3.keySet()) {
                            JSONObject jSONObject3 = new JSONObject();
                            jSONArray.put(jSONObject3);
                            jSONObject3.put("word", str2);
                            jSONObject3.put("word_history", new JSONObject((String) hashMap3.get(str2)));
                        }
                        jSONObject.put("search_history", jSONArray);
                    }
                    String a = c.a(this.G, jSONObject, this.H);
                    HttpPost httpPost = new HttpPost("https://counter.kingsoft.com/index2.php");
                    if (a.getBytes().length >= 2048) {
                        httpPost.setHeader(AsyncHttpClient.HEADER_CONTENT_ENCODING, AsyncHttpClient.ENCODING_GZIP);
                    }
                    ArrayList arrayList = new ArrayList();
                    arrayList.add(new BasicNameValuePair("q", a));
                    httpPost.setEntity(new UrlEncodedFormEntity(arrayList, AsyncHttpResponseHandler.DEFAULT_CHARSET));
                    if (200 == c.d().execute(httpPost).getStatusLine().getStatusCode()) {
                        this.F.delete();
                    }
                }
            }
        } catch (Exception e) {
            Log.e("KStatistics", "Upload data failed", e);
        }
    }
}